package demo9;

public class Test {
    public static void func1(Animal animal){
        animal.eat();
    }
    public static void walk(IRunning iRunning){
        iRunning.run();
    }
    public static void fly(IFly iFly){
        iFly.fly();
    }
    public static void swimming(ISwimming iSwimming){
        iSwimming.swim();
    }

    public static void main(String[] args) {
        Dog dog1 = new Dog("旺财",9);
        Dog dog2 = new Dog("旺财",9);
        System.out.println(dog1==dog2);
        System.out.println(dog1.equals(dog2));
        System.out.println(dog1.equals(dog1));
        System.out.println("======");
        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());
    }
    public static void main3(String[] args) {
        walk(new Robot());
    }
    public static void main2(String[] args) {
        walk(new Duck("唐老鸭",6));
        walk(new Dog("旺财",8));

        System.out.println("============");
        fly(new Duck("唐老鸭",6));
        System.out.println("=============");
        swimming(new Fish("泡泡",9));
        swimming(new Duck("唐老鸭",7));
        swimming(new Dog("星夜",6));
    }
    public static void main1(String[] args) {
        func1(new Duck("唐老鸭",14));
        func1(new Dog("星夜",7));
        func1(new Fish("泡泡",6));
    }

}
